<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>渠道物流策略</title>
    <link rel="shortcut icon" href="favicon.ico" />
    <script src="../../res/js/comm.js"></script>
    <link
      href="../../res../res/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"
      rel="stylesheet"
    />
    <link href="../../res/plugins/channel/css/yfChannel.css" rel="stylesheet" />
    <link
      href="../../css../css/logistics/deliveryTypeManager.css"
      rel="stylesheet"
    />
    <script src="../../res/plugins/channel/yfChannel.js"></script>
    <script src="../../js/wms/select.js"></script>
    <script src="../../res/js/ajaxUtil.js"></script>
    <style>
      .select2-container--open {
        z-index: 10000000000;
      }
    </style>
  </head>

  <body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
      <div class="panel panel-info">
        <div class="panel-heading">
          <i class="fa fa-info-circle"></i> 渠道物流策略
        </div>
        <div class="panel-body">
          <div class="ibox-query">
            <div
              class="col-sm-2"
              name="providerSelectsPluginsDiv"
              style="display: none"
            ></div>
            <form id="queryForm" method="post" class="form-horizontal">
              <div class="form-group">
                <label class="col-sm-1 control-label">顶级渠道</label>
                <div class="col-sm-2" name="channelPluginsDiv"></div>
                <label class="col-sm-1 control-label">物流类型</label>
                <div class="col-sm-2">
                  <select name="deliveryType" class="form-control">
                    <option value="">--请选择--</option>
                    <option value="NORMAL">普通</option>
                    <option value="URGENT">加急</option>
                    <option value="REAL_TIME">实时</option>
                    <option value="SELF_PICK">自提</option>
                  </select>
                </div>
                <div>
                  <button
                    style="margin-left: 100px"
                    class="btn btn-info"
                    onclick="$.openx.query()"
                    type="button"
                  >
                    <i class="glyphicon glyphicon-search"></i> 查询
                  </button>
                  <button
                    style="margin-left: 10px"
                    class="btn btn-info"
                    onclick="javascript:$('#queryForm')[0].reset();$.openx.query()"
                    type="button"
                  >
                    <i class="glyphicon glyphicon-share-alt"></i> 重置
                  </button>
                </div>
              </div>
              <div class="hr-line-dashed"></div>
            </form>
          </div>

          <div class="row row-lg">
            <div class="col-sm-12">
              <div id="partnerbar"></div>
              <table id="table">
                <thead>
                  <tr>
                    <th data-field="stats" data-checkbox="true"></th>
                    <th
                      data-align="center"
                      data-field="id"
                      data-visible="false"
                    ></th>
                    <th
                      data-align="center"
                      data-field="topChannelCode"
                      data-visible="false"
                    ></th>
                    <th
                      data-align="center"
                      data-formatter="showProviderRuleListFormatter"
                    >
                      所属渠道
                    </th>
                    <th
                      data-align="center"
                      data-field="deliveryType"
                      data-visible="false"
                    >
                      物流类型
                    </th>
                    <th data-align="center" data-field="deliveryTypeName">
                      物流类型
                    </th>
                    <th data-align="center" data-field="deliveryPrice">价格</th>
                    <th
                      data-align="center"
                      data-field="appointProvider"
                      data-formatter="appointProviderRowFormatter"
                    >
                      指定物流
                    </th>
                    <th
                      data-align="center"
                      data-field="default"
                      data-formatter="isDefault"
                    >
                      是否为默认
                    </th>
                    <th
                      data-field="status"
                      data-formatter="statusFormat"
                      data-width="80px"
                    >
                      状态
                    </th>
                  </tr>
                </thead>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!--新增物流界面-->
    <script type="text/html" id="addUpdateTpl">
      <div>
        <form class="form-horizontal" id="addDeliveryTypeForm">
          <div class="col-md-12" style="margin-top: 20px">
            <div id="deliveryEditModalInfoSection">
              <input type="hidden" name="topChannelName" />
              <input type="hidden" name="id" />

              <div class="form-group">
                <label class="col-sm-4 control-label"
                  ><font color="red">* </font>所属渠道：</label
                >
                <div
                  class="col-sm-8"
                  name="topChannelTypeDiv"
                  onchange="changeToChannelCode()"
                ></div>
              </div>

              <div class="form-group">
                <label class="col-sm-4 control-label"
                  ><font color="red">* </font>物流类型：</label
                >
                <div class="col-sm-8">
                  <select
                    class="form-control"
                    name="deliveryType"
                    id="deliveryType"
                    required="true"
                    placeholder="请选择物流类型"
                  >
                    <option value="">--请选择--</option>
                    <option value="NORMAL">普通</option>
                    <option value="URGENT">加急</option>
                    <option value="REAL_TIME">实时</option>
                    <option value="SELF_PICK">自提</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-4 control-label"
                  ><font color="red">* </font>物流价格：</label
                >
                <div class="col-sm-8">
                  <input
                    name="deliveryPrice"
                    id="deliveryPrice"
                    class="form-control"
                    placeholder="请输入物流价格"
                    type="text"
                    required="true"
                    value="{{d.deliveryPrice ? d.deliveryPrice : 0}}"
                  />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-4 control-label">是否默认：</label>
                <div class="col-sm-8">
                  <div class="radio radio-info radio-inline">
                    <input type="radio" name="isDefault" id="statusRadio1"
                    value="true" {{d.default ? 'checked' : ''}} />
                    <label for="statusRadio1"> 是 </label>
                  </div>
                  <div class="radio radio-danger radio-inline">
                    <input type="radio" name="isDefault" id="statusRadio2"
                    value="false" {{!d.default ? 'checked' : ''}} />
                    <label for="statusRadio2"> 否</label>
                  </div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-4 control-label">指定物流：</label>
                <div class="col-sm-8">
                  <div class="radio radio-info radio-inline">
                    <input type="radio" name="isAppointProvider"
                    id="appointProvider1" value="true" {{d.appointProvider ?
                    'checked' : ''}} />
                    <label for="appointProvider1"> 选中配置 </label>
                  </div>
                  <div class="radio radio-danger radio-inline">
                    <input type="radio" name="isAppointProvider"
                    id="appointProvider2" value="false"
                    onclick="hideDeliveryProvider()" {{!d.appointProvider ?
                    'checked' : ''}} />
                    <label for="appointProvider2">
                      不配置（以仓库策略为准）</label
                    >
                  </div>
                </div>
              </div>
            </div>
            <div style="display:none;" class="hr-line-dashed"></div>
            <div id="deliveryProvider" class="delivery-provider">
              <div
                id="deliveryProviderCommon"
                class="delivery-provider-common"
              ></div>
              <div class="hr-line-dashed"></div>
              <div
                id="deliveryProviderSection"
                class="delivery-provider-section"
              >
                <div class="v-flex v-flex-align-center v-flex-justify-between">
                  <div>个性化配置</div>
                  <div class="v-btn-text" onclick="createInitChildChannel()">
                    新增子渠道
                  </div>
                </div>
              </div>
            </div>
          </div>
        </form>
      </div>
    </script>

    <script type="text/html" id="providerRuleListTpl">
      <div class="ibox float-e-margins">
        <div class="ibox-content">
          <form class="form-horizontal" id="providerRuleListForm">
            <div class="form-group">
              <label class="col-sm-1 control-label" style="width: 100px"
                >渠道编码</label
              >
              <div class="col-sm-2">
                <input name="channelCode2" class="form-control" type="text" />
              </div>
              <label class="col-sm-1 control-label" style="width: 100px"
                >渠道名称</label
              >
              <div class="col-sm-2">
                <input name="channelName" class="form-control" type="text" />
              </div>
              <label class="col-sm-1 control-label" style="width: 100px"
                >操作人</label
              >
              <div class="col-sm-2">
                <input name="operator" class="form-control" type="text" />
              </div>
              <label class="col-sm-1 control-label" style="width: 100px"
                >物流公司</label
              >
              <div
                id="providerCode"
                class="col-sm-2"
                name="providerPluginsDiv"
              ></div>
            </div>
            <div class="form-group">
              <div>
                <button
                  style="margin-left: 60px;"
                  class="btn btn-info"
                  onclick='queryChannelProviderRuleList("{{d.id}}")'
                  type="button"
                >
                  <i class="glyphicon glyphicon-search"></i> 查询
                </button>
              </div>
            </div>
          </form>
          <div class="hr-line-dashed"></div>
          <div class="row row-lg">
            <div class="col-lg-12">
              <table id="providerRuleTable">
                <thead>
                  <tr>
                    <th data-align="center" data-field="sortNum">序号</th>
                    <th data-align="center" data-field="channelCode">
                      渠道编码
                    </th>
                    <th data-align="center" data-field="channelName">
                      渠道名称
                    </th>
                    <th
                      data-align="center"
                      data-formatter="showTimeRangeFormat"
                    >
                      时间
                    </th>
                    <th
                      data-align="center"
                      data-formatter="showProviderNameFormat"
                    >
                      物流公司
                    </th>
                    <th data-align="center" data-field="range">
                      配送范围（km）
                    </th>
                    <th data-align="center" data-field="interval">
                      等待接单时间（分）
                    </th>
                    <th data-align="center" data-formatter="showFormatScrambleType">
                      抢单方式
                    </th>
                    <th data-align="center" data-field="operator">操作人</th>
                    <th
                      data-align="center"
                      data-field="modifyTime"
                      data-formatter="dateFormat"
                    >
                      最后修改时间
                    </th>
                  </tr>
                </thead>
              </table>
            </div>
          </div>
        </div>
      </div>
    </script>
  </body>
</html>

<script type="text/javascript">
  (function () {
    $.openx.loadScript([
      "../../res/js/uuid.js",
      "../../js/logistics/deliveryTypeManager.js",
      "../../res/plugins/yifeng/channel.js",
      "../../res/plugins/yifeng/providerSelects.js",
    ]);
  })();
</script>
